<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Welcome extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     * 		http://example.com/index.php/welcome
     * 	- or -  
     * 		http://example.com/index.php/welcome/index
     * 	- or -
     * Since this controller is set as the default controller in 
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see http://codeigniter.com/user_guide/general/urls.html
     */
    public function index() {
        //update_user();
        $Array_Data['UserInfo'] = $this->session->userdata('UserInfo');
        $UserInfo = $Array_Data['UserInfo'];
        if ($UserInfo['UserType'] == 'work') {
            $query = $this->db->get_where(MYSQL_TABLE_PREFLIX . TABLE_USER3_ACCOUNTS_INFORMATION, array('RelUserEmail' => $UserInfo['UserEmail']));
            if ($query->num_rows == 0) {
                redirect(site_url() . "/user_group3/account/fill_in");
            } else {
                $Array_Data = array_merge($Array_Data, $query->result_array());
                $this->load->view('user_group3/welcome', $Array_Data);
            }
        } elseif ($UserInfo['UserType'] == 'hire') {
            $query = $this->db->get_where(MYSQL_TABLE_PREFLIX . TABLE_USER2_ACCOUNTS_INFORMATION, array('RelUserEmail' => $UserInfo['UserEmail']));
            if ($query->num_rows == 0) {
                redirect(site_url() . "/user_group2/account/fill_in");
            } else {
                $Array_Data = array_merge($Array_Data, $query->result_array());
                $this->load->view('user_group2/welcome', $Array_Data);
            }
        } else {
            $this->load->view('user_group3/welcome', $Array_Data);
        }
    }

    public function not_authorized() {
        $Array_Data['Header'] = "You're authorized for this page!";
        $Array_Data['Content'] = "Please login with authorized permission to use this page.";
        $this->load->view('annoucement', $Array_Data);
    }

    public function test() {
        $this->load->view('user_group3/account_management/account_management_main');
    }

}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */